package com.ysh.spring.body.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Date;

/**
 * Created by Jackiechan on 2022/8/30 14:27
 *
 * @author Jackiechan
 * @version 1.0
 * @since 1.0
 */
//@JsonInclude(JsonInclude.Include.NON_NULL)//不会处理null值
@JsonInclude(JsonInclude.Include.NON_EMPTY)//null或者""都不会处理
public class Item {

    private Long id;
    private String name;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")//从json转到对象和从对象转成json都会以这个格式为准
    private Date updateTime;
    @JsonProperty("jieshao")//别名,通过别名来传递或者返回数据
    private String description;

    private Double price;

    @JsonIgnore//忽略当前属性,不论是从客户端传过来的还是返回给客户端的都不会解析
    private Double jinhuojiag = 0.1;

    public Double getJinhuojiag() {
        return jinhuojiag;
    }

    public void setJinhuojiag(Double jinhuojiag) {
        this.jinhuojiag = jinhuojiag;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "Item{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", updateTime=" + updateTime +
                ", description='" + description + '\'' +
                ", price=" + price +
                '}';
    }
}
